within MediaDevel.Common;

package Functions
//  extends Icons.Basic.Library;

    function getPlatformIndex
      extends Modelica.Icons.Function;
      output Integer p;
/*
      input PlatformType P_type;
    algorithm
      if P_type == PlatformType.OpenModelica then
         p := 0;
      elseif P_type == PlatformType.MathModelica then
          p := 3;
      end if;
*/
      input String P_type;
    algorithm
      if P_type == "OpenModelica" then
         p := 0;
      elseif P_type == "Dymola" then
          p := 2;
      elseif P_type == "MathModelica" then
          p := 3;
      end if;
    end getPlatformIndex;


    function getStatesIndex
      extends Modelica.Icons.Function;
      output Integer state_type;
//      input Integer Pindex;
//      input IndependentVariables Ind;
      input String S_type;
    algorithm
/*
      if Pindex == 3 then
      else
      if Ind == IndependentVariables.T then
          state_type := 0;
      elseif Ind == IndependentVariables.pT then
          state_type := 1;
      elseif Ind == IndependentVariables.pTX then
          state_type := 2;
      end if;
      end if;
*/
      if S_type == "T" then
         state_type := 0;
      elseif S_type == "pT" then
          state_type := 1;
      elseif S_type == "ph" then
          state_type := 2;
      end if;
    end getStatesIndex;

    function getAccuracyIndex
      extends Modelica.Icons.Function;
      output Integer index;
//      input Integer Pindex;
//      input IndependentVariables Ind;
      input String S_type;
    algorithm
/*
      if Pindex == 3 then
      else
      if Ind == IndependentVariables.T then
          index := 0;
      elseif Ind == IndependentVariables.pT then
          index := 1;
      elseif Ind == IndependentVariables.pTX then
          index := 2;
      end if;
      end if;
*/
      if S_type == "Simple" then
         index := 0;
      elseif S_type == "Ideal" then
          index := 1;
      elseif S_type == "Practical" then
          index := 2;
      elseif S_type == "Strict" then
          index := 3;
      end if;
    end getAccuracyIndex;

end Functions;

